using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vInventoryReqDynamicMap : EntityTypeConfiguration<vInventoryReqDynamic>
    {
        public vInventoryReqDynamicMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ITEM, t.DESC, t.TypeName, t.categoryName, t.Type, t.Category });

            // Properties
            this.Property(t => t.ITEM)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.DESC)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.ABCCLASSIF)
                .HasMaxLength(2);

            this.Property(t => t.XYZCLASSIF)
                .HasMaxLength(2);

            this.Property(t => t.TypeName)
                .IsRequired()
                .HasMaxLength(25);

            this.Property(t => t.categoryName)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Type)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Category)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("vInventoryReqDynamic");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.DESC).HasColumnName("DESC");
            this.Property(t => t.OnHand).HasColumnName("OnHand");
            this.Property(t => t.Sales_Peak).HasColumnName("Sales_Peak");
            this.Property(t => t.AMS).HasColumnName("AMS");
            this.Property(t => t.ABCCLASSIF).HasColumnName("ABCCLASSIF");
            this.Property(t => t.XYZCLASSIF).HasColumnName("XYZCLASSIF");
            this.Property(t => t.TypeName).HasColumnName("TypeName");
            this.Property(t => t.categoryName).HasColumnName("categoryName");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Category).HasColumnName("Category");
            this.Property(t => t.Net_Demand).HasColumnName("Net_Demand");
        }
    }
}
